#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   wait_elemnet.py
@Time    :   2024/01/16 16:13:24
@Author  :   chakcy 
@Email   :   947105045@qq.com
@description   :   等待元素
'''

from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By

def wait_for_element_with_id(driver:Chrome, element_id:str):
    """等待id为element_id的元素加载完成"""
    wait = WebDriverWait(driver, 10)
    element = wait.until(EC.presence_of_element_located((By.ID, element_id)))
    return element
